﻿<vuc:VNetUserControl x:Class="VNet.VisiSuite.Controls.TopSlidePanel" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:vuc="clr-namespace:VNet.VisiSuite.Controls"
        mc:Ignorable="d" Panel.ZIndex="500" VerticalAlignment="Top" Height="145" d:DesignHeight="300" d:DesignWidth="300">

    <UserControl.Resources>
    </UserControl.Resources>

    <Border x:Name="_topPanel" Background="Black" HorizontalAlignment="Stretch" VerticalAlignment="Top" Height="145">
        <Border.RenderTransform>
            <TransformGroup>
                <TranslateTransform x:Name="_topPanelTranslate" X="0" Y="-145" />
            </TransformGroup>
        </Border.RenderTransform>
        <StackPanel Orientation="Vertical" HorizontalAlignment="Stretch">
            <TextBlock FontFamily="Segoe UI Light" FontSize="28" Foreground="White" Margin="16,6,0,6" Text="{Binding Title, Mode=OneWay}" />
            <ListView x:Name="_tiles" Background="Black" BorderBrush="Transparent" BorderThickness="0" Width="Auto" Height="Auto" Margin="14,0,0,0" Focusable="False" HorizontalAlignment="Stretch"
                    HorizontalContentAlignment="Left" SelectionChanged="OnPanelSelection">
                <ListView.Resources>
                    <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Black" />
                    <SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" Color="DarkGreen" />
                </ListView.Resources>
                <ListView.ItemsPanel>
                    <ItemsPanelTemplate>
                        <WrapPanel Width="{Binding (FrameworkElement.ActualWidth), 
                            RelativeSource={RelativeSource AncestorType=ScrollContentPresenter}}" ItemWidth="{Binding (ListView.View).ItemWidth, RelativeSource={RelativeSource AncestorType=ListView}}" ItemHeight="{Binding (ListView.View).ItemHeight, 
                            RelativeSource={RelativeSource AncestorType=ListView}}" />
                    </ItemsPanelTemplate>
                </ListView.ItemsPanel>
                <ListView.ItemTemplate>
                    <DataTemplate>
                        <Border x:Name="border1" BorderThickness="2" BorderBrush="{Binding Background}" Background="{Binding Background}" Margin="0,0,8,0" Tag="{Binding Foreground}">
                            <Grid x:Name="grid1" Margin="0,0,0,0" Width="160" Height="80" Background="{Binding Background}" VerticalAlignment="Center">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="76" />
                                    <ColumnDefinition Width="*" />
                                </Grid.ColumnDefinitions>
                                <ContentControl Grid.Column="0" ContentTemplate="{Binding Path=Icon}" Background="Red" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center" />
                                <TextBlock Grid.Column="1" Foreground="{Binding Foreground}" FontFamily="Segoe UI" FontSize="16" Text="{Binding Path=Title}" VerticalAlignment="Center" />
                            </Grid>
                        </Border>
                        <DataTemplate.Triggers>
                            <DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type ListViewItem}}, Path=IsMouseOver}" Value="True">
                                <Setter Property="Background" TargetName="grid1" Value="{Binding HoverColor}" />
                            </DataTrigger>
                        </DataTemplate.Triggers>
                    </DataTemplate>
                </ListView.ItemTemplate>
                <ListView.ItemContainerStyle>
                    <Style TargetType="{x:Type ListViewItem}">
                        <Setter Property="Height" Value="80" />
                        <Setter Property="Background" Value="Black" />
                        <Setter Property="Focusable" Value="True" />
                        <Setter Property="Foreground" Value="#FF4B94EC" />
                    </Style>
                </ListView.ItemContainerStyle>
            </ListView>
        </StackPanel>
    </Border>
</vuc:VNetUserControl>